package tech.mobi.child;

import java.util.ArrayList;

import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.ImageScaleType;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;

import tech.mobi.child.base.BaseAct;
import tech.mobi.child.bean.PictureBean;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;

public class CZDAClientListPicMainAct extends BaseAct implements
		OnClickListener {

	private Button btnBack;
	private Button btnUpload;

	private TextView tvTitle;
	private ProgressBar progress;

	private GridView gridview;

	/*****************************
	 * 成长档案类别 flag=1:我们的一家; flag=2:第一天上学; flag=3:精彩的瞬间; flag=5:舞台上的我;
	 * flag=7:得意的作品; flag=9:欢乐的课堂; flag=10:我的好朋友;
	 *****************************/
	private String strTypeId = "";
	private String strTitle;

	private ImageLoader imageLoader = ImageLoader.getInstance();
	private static final String STATE_POSITION = "STATE_POSITION";
	DisplayImageOptions options;
	private Bundle savedInstanceState;
	ArrayList<PictureBean> data = null;
//	String[] imageUrls = {
//			"昨天",
//			"a",
//			"a",
//			"http://f.hiphotos.baidu.com/album/w%3D2048/sign=59b95f461c950a7b753549c43ee963d9/f31fbe096b63f6247ed13d738644ebf81a4ca335.jpg",
//			"http://h.hiphotos.baidu.com/album/w%3D2048/sign=77fc0c692cf5e0feee188e01685835a8/c8177f3e6709c93df72c0d879e3df8dcd00054e7.jpg",
//			"http://h.hiphotos.baidu.com/album/w%3D2048/sign=b6f5d0a66159252da3171a0400a3023b/77094b36acaf2eddccc07b558c1001e93901935c.jpg",
//			"http://g.hiphotos.baidu.com/album/w%3D2048/sign=25f3a4fdd058ccbf1bbcb23a2de0bd3e/fd039245d688d43f11b99cbd7c1ed21b0ef43b68.jpg",
//			"http://pic3.nipic.com/20090609/81719_172853086_2.jpg",
//			"",
//
//			"9月26日",
//			"a",
//			"a",
//			"http://i.stack.imgur.com/i9cQU.jpg",
//			"http://g.hiphotos.baidu.com/album/w%3D2048/sign=cfa3338bd043ad4ba62e41c0b63a5baf/4bed2e738bd4b31c91915a9586d6277f9e2ff86b.jpg",
//			"http://g.hiphotos.baidu.com/album/w%3D2048/sign=5fdec2e3c2cec3fd8b3ea075e2b0d53f/72f082025aafa40fad37f1f2aa64034f78f0192f.jpg",
//			"http://f.hiphotos.baidu.com/album/w%3D2048/sign=59b95f461c950a7b753549c43ee963d9/f31fbe096b63f6247ed13d738644ebf81a4ca335.jpg",
//			"http://h.hiphotos.baidu.com/album/w%3D2048/sign=77fc0c692cf5e0feee188e01685835a8/c8177f3e6709c93df72c0d879e3df8dcd00054e7.jpg",
//			"http://h.hiphotos.baidu.com/album/w%3D2048/sign=b6f5d0a66159252da3171a0400a3023b/77094b36acaf2eddccc07b558c1001e93901935c.jpg",
//			"http://g.hiphotos.baidu.com/album/w%3D2048/sign=25f3a4fdd058ccbf1bbcb23a2de0bd3e/fd039245d688d43f11b99cbd7c1ed21b0ef43b68.jpg",
//			"http://pic3.nipic.com/20090609/81719_172853086_2.jpg",
//			"",
//			"9月22日",
//			"a",
//			"a",
//			"http://g.hiphotos.baidu.com/album/w%3D2048/sign=cfa3338bd043ad4ba62e41c0b63a5baf/4bed2e738bd4b31c91915a9586d6277f9e2ff86b.jpg",
//			"http://g.hiphotos.baidu.com/album/w%3D2048/sign=5fdec2e3c2cec3fd8b3ea075e2b0d53f/72f082025aafa40fad37f1f2aa64034f78f0192f.jpg",
//			"http://f.hiphotos.baidu.com/album/w%3D2048/sign=59b95f461c950a7b753549c43ee963d9/f31fbe096b63f6247ed13d738644ebf81a4ca335.jpg",
//			"http://h.hiphotos.baidu.com/album/w%3D2048/sign=77fc0c692cf5e0feee188e01685835a8/c8177f3e6709c93df72c0d879e3df8dcd00054e7.jpg",
//			"http://h.hiphotos.baidu.com/album/w%3D2048/sign=b6f5d0a66159252da3171a0400a3023b/77094b36acaf2eddccc07b558c1001e93901935c.jpg",
//			"http://g.hiphotos.baidu.com/album/w%3D2048/sign=25f3a4fdd058ccbf1bbcb23a2de0bd3e/fd039245d688d43f11b99cbd7c1ed21b0ef43b68.jpg",
//			"http://pic3.nipic.com/20090609/81719_172853086_2.jpg" // ,
	// "http://g.hiphotos.baidu.com/album/w%3D2048/sign=cfa3338bd043ad4ba62e41c0b63a5baf/4bed2e738bd4b31c91915a9586d6277f9e2ff86b.jpg",
	// "http://g.hiphotos.baidu.com/album/w%3D2048/sign=5fdec2e3c2cec3fd8b3ea075e2b0d53f/72f082025aafa40fad37f1f2aa64034f78f0192f.jpg",
	// "http://f.hiphotos.baidu.com/album/w%3D2048/sign=59b95f461c950a7b753549c43ee963d9/f31fbe096b63f6247ed13d738644ebf81a4ca335.jpg",
	// "http://h.hiphotos.baidu.com/album/w%3D2048/sign=77fc0c692cf5e0feee188e01685835a8/c8177f3e6709c93df72c0d879e3df8dcd00054e7.jpg",
	// "http://h.hiphotos.baidu.com/album/w%3D2048/sign=b6f5d0a66159252da3171a0400a3023b/77094b36acaf2eddccc07b558c1001e93901935c.jpg",
	// "http://g.hiphotos.baidu.com/album/w%3D2048/sign=25f3a4fdd058ccbf1bbcb23a2de0bd3e/fd039245d688d43f11b99cbd7c1ed21b0ef43b68.jpg",
	// "http://pic3.nipic.com/20090609/81719_172853086_2.jpg",
	// "http://g.hiphotos.baidu.com/album/w%3D2048/sign=cfa3338bd043ad4ba62e41c0b63a5baf/4bed2e738bd4b31c91915a9586d6277f9e2ff86b.jpg",
	// "http://g.hiphotos.baidu.com/album/w%3D2048/sign=5fdec2e3c2cec3fd8b3ea075e2b0d53f/72f082025aafa40fad37f1f2aa64034f78f0192f.jpg",
	// "http://f.hiphotos.baidu.com/album/w%3D2048/sign=59b95f461c950a7b753549c43ee963d9/f31fbe096b63f6247ed13d738644ebf81a4ca335.jpg",
	// "http://h.hiphotos.baidu.com/album/w%3D2048/sign=77fc0c692cf5e0feee188e01685835a8/c8177f3e6709c93df72c0d879e3df8dcd00054e7.jpg",
	// "http://h.hiphotos.baidu.com/album/w%3D2048/sign=b6f5d0a66159252da3171a0400a3023b/77094b36acaf2eddccc07b558c1001e93901935c.jpg",
	// "http://g.hiphotos.baidu.com/album/w%3D2048/sign=25f3a4fdd058ccbf1bbcb23a2de0bd3e/fd039245d688d43f11b99cbd7c1ed21b0ef43b68.jpg",
	// "http://pic3.nipic.com/20090609/81719_172853086_2.jpg"
//	};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.czda_client_pic_main);

		progress = (ProgressBar) this.findViewById(R.id.progress);
		tvTitle = (TextView) this.findViewById(R.id.tvTitle);
		btnBack = (Button) this.findViewById(R.id.btnBack);
		btnBack.setOnClickListener(this);
		btnUpload = (Button) this.findViewById(R.id.btnUpload);
		btnUpload.setOnClickListener(this);

		Intent intent = this.getIntent();
		if (intent != null && !"".equals(intent.getStringExtra("typeId"))) {
			strTypeId = intent.getStringExtra("typeId");
		}
		if (intent != null && !"".equals(intent.getStringExtra("titleName"))) {
			strTitle = intent.getStringExtra("titleName");
			tvTitle.setText(getText(Integer.parseInt(strTitle)));

		} else {
			tvTitle.setText("");
		}
		
		
		PictureBean beanTemp = null;
		 data = new ArrayList<PictureBean>();
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("昨天");
		 beanTemp.setPicadd("昨天");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("昨天");
		 beanTemp.setPicadd("a");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("昨天");
		 beanTemp.setPicadd("a");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);

		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("昨天");
		 beanTemp.setPicadd("http://f.hiphotos.baidu.com/album/w%3D2048/sign=59b95f461c950a7b753549c43ee963d9/f31fbe096b63f6247ed13d738644ebf81a4ca335.jpg");
		 beanTemp.setPicdes("1唐山");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("昨天");
		 beanTemp.setPicadd("http://h.hiphotos.baidu.com/album/w%3D2048/sign=77fc0c692cf5e0feee188e01685835a8/c8177f3e6709c93df72c0d879e3df8dcd00054e7.jpg");
		 beanTemp.setPicdes("2唐山");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("昨天");
		 beanTemp.setPicadd("http://g.hiphotos.baidu.com/album/w%3D2048/sign=25f3a4fdd058ccbf1bbcb23a2de0bd3e/fd039245d688d43f11b99cbd7c1ed21b0ef43b68.jpg");
		 beanTemp.setPicdes("3唐山");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("昨天");
		  beanTemp.setPicadd("http://h.hiphotos.baidu.com/album/w%3D2048/sign=b6f5d0a66159252da3171a0400a3023b/77094b36acaf2eddccc07b558c1001e93901935c.jpg");
		 beanTemp.setPicdes("4唐山");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("昨天");
		 beanTemp.setPicadd("http://pic3.nipic.com/20090609/81719_172853086_2.jpg");
		 beanTemp.setPicdes("5唐山");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("昨天");
		 beanTemp.setPicadd("");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月25日");
		 beanTemp.setPicadd("9月25日");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月25日");
		 beanTemp.setPicadd("a");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月25日");
		 beanTemp.setPicadd("a");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);

		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月25日");
		 beanTemp.setPicadd("http://i.stack.imgur.com/i9cQU.jpg");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月25日");
		 beanTemp.setPicadd("http://g.hiphotos.baidu.com/album/w%3D2048/sign=cfa3338bd043ad4ba62e41c0b63a5baf/4bed2e738bd4b31c91915a9586d6277f9e2ff86b.jpg");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月25日");
		 beanTemp.setPicadd("http://g.hiphotos.baidu.com/album/w%3D2048/sign=5fdec2e3c2cec3fd8b3ea075e2b0d53f/72f082025aafa40fad37f1f2aa64034f78f0192f.jpg");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月25日");
		 beanTemp.setPicadd("http://f.hiphotos.baidu.com/album/w%3D2048/sign=59b95f461c950a7b753549c43ee963d9/f31fbe096b63f6247ed13d738644ebf81a4ca335.jpg");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月25日");
		 beanTemp.setPicadd("http://h.hiphotos.baidu.com/album/w%3D2048/sign=77fc0c692cf5e0feee188e01685835a8/c8177f3e6709c93df72c0d879e3df8dcd00054e7.jpg");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月25日");
		 beanTemp.setPicadd("http://h.hiphotos.baidu.com/album/w%3D2048/sign=b6f5d0a66159252da3171a0400a3023b/77094b36acaf2eddccc07b558c1001e93901935c.jpg");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月25日");
		 beanTemp.setPicadd("http://pic3.nipic.com/20090609/81719_172853086_2.jpg");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月25日");
		 beanTemp.setPicadd("");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月25日");
		 beanTemp.setPicadd("");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月21日");
		 beanTemp.setPicadd("9月21日");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月21日");
		 beanTemp.setPicadd("a");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月21日");
		 beanTemp.setPicadd("a");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月21日");
		 beanTemp.setPicadd("http://pic3.nipic.com/20090609/81719_172853086_2.jpg");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月21日");
		 beanTemp.setPicadd("http://h.hiphotos.baidu.com/album/w%3D2048/sign=77fc0c692cf5e0feee188e01685835a8/c8177f3e6709c93df72c0d879e3df8dcd00054e7.jpg");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月21日");
		 beanTemp.setPicadd("http://www.0574net.com/files/Content/%CE%DE%B1%EA%CC%E2-1%B8%B1%B1%BE.jpg");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月21日");
		 beanTemp.setPicadd("http://www.xzsem.com/Marketing/UploadFiles_8857/201005/20100523010943539.jpg");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月21日");
		 beanTemp.setPicadd("http://www.ucantech.com/ImgUpload/editor/888888%281%29.jpg");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月21日");
		 beanTemp.setPicadd("http://www.bodao.org.cn/2010/Edit/uploadfile/2010043060211953.jpg");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月21日");
		 beanTemp.setPicadd("http://wp4.sina.cn/woriginal/6335e7edgw1dpjf441vcnj.jpg");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月21日");
		 beanTemp.setPicadd("http://a4.att.hudong.com/27/49/01300000212958122225492140003.jpg");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月21日");
		 beanTemp.setPicadd("http://news.51wj.com/uploads/news/20111009103149101.jpg");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月21日");
		 beanTemp.setPicadd("http://img4.tiboo.cn/1001/241859_12643986901.jpg");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月21日");
		 beanTemp.setPicadd("");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);
		 beanTemp = new PictureBean();
		 beanTemp.setPicdate("9月21日");
		 beanTemp.setPicadd("");
		 beanTemp.setPicdes("");
		 data.add(beanTemp);


		 
		bindDatas();
	}

	private void bindDatas() {

		// method.
		ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
				getApplicationContext())
				.threadPriority(Thread.NORM_PRIORITY - 2)
				.denyCacheImageMultipleSizesInMemory()
				.discCacheFileNameGenerator(new Md5FileNameGenerator())
				.discCacheFileCount(60)// Set max cache file count in SD card
				.tasksProcessingOrder(QueueProcessingType.LIFO).enableLogging() // Not
																				// necessary
																				// in
																				// common
				.build();

		// Initialize ImageLoader with configuration
		ImageLoader.getInstance().init(config);

		int pagerPosition = 0;

		if (savedInstanceState != null) {
			pagerPosition = savedInstanceState.getInt(STATE_POSITION);
		}

		options = new DisplayImageOptions.Builder()
				.showImageForEmptyUri(R.drawable.desklogo)
				.showImageOnFail(R.drawable.desklogo)
				.resetViewBeforeLoading(true).cacheOnDisc(true)
				.imageScaleType(ImageScaleType.EXACTLY)
				.bitmapConfig(Bitmap.Config.RGB_565)
				.displayer(new FadeInBitmapDisplayer(300)).build();

		gridview = (GridView) this.findViewById(R.id.gridview);
		((GridView) gridview).setAdapter(new ImageAdapter(data));
		gridview.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				if (!"".equals(((ImageView) view.findViewById(R.id.image))
						.getTag())) {
					String s = (String) ((TextView) view
							.findViewById(R.id.tvDate)).getTag();
					
					startImagePagerActivity(position, s);
				}
			}
		});

		gridview.setOnScrollListener(new AbsListView.OnScrollListener() {

			@Override
			public void onScrollStateChanged(AbsListView view, int scrollState) {
				// TODO Auto-generated method stub
				// ((OnScrollListener) gridview).onScrollStateChanged(view,
				// scrollState);
				// Toast.makeText(context, text, duration)
			}

			@Override
			public void onScroll(AbsListView view, int firstVisibleItem,
					int visibleItemCount, int totalItemCount) {
				// TODO Auto-generated method stub
				// ((OnScrollListener) gridview).onScroll(view,
				// firstVisibleItem, visibleItemCount, totalItemCount);
			}

		});

	}

	@Override
	public void onClick(View v) {
		if (v.getId() == R.id.btnBack) {
			this.finish();
		} else if(v.getId() == R.id.btnUpload) {
			Intent intent = new Intent(this,CZDAClientListPicAddMainAct.class);
			intent.putExtra("typeId", strTypeId);
			intent.putExtra("titleName", strTitle);
			startActivity(intent);
		}
	}

	@Override
	public void init() {

	}

	@Override
	public void refresh(Object... param) {

	}

	@Override
	protected boolean isRouteDisplayed() {
		return false;
	}

	private void startImagePagerActivity(int position, String s) {
		int startIndex = 0;
		String str = "";
		boolean b = true;
		for (int i = 0; i < data.size(); i++) {
			
			if (((PictureBean)data.get(i)).getPicdate().equals(s)) {
				
				if(b) {
					startIndex = i;
					b = false;
				}
				String sTemp = ((PictureBean)data.get(i)).getPicadd();
				if (!sTemp.equals("") 
						&& !sTemp.equals("a")
						&& sTemp.indexOf("日") < 0
						&& sTemp.indexOf("天") < 0) {
					str += ((PictureBean)data.get(i)).getPicadd().toString() + ",";
				}
			}
		}
		Log.i("MyLog", "str:" + str + ",s:" + s +",Length" + str.split(",").length+",position:"+position + "-" + startIndex);
		Intent intent = new Intent(this, CZDAClientDetailPicAct.class);
		intent.putExtra("Images", str.split(","));
		intent.putExtra("ImagesPosition", position - startIndex - 3);// position
		startActivity(intent);
	}

	public class ImageAdapter extends BaseAdapter {
		private ArrayList<PictureBean> pathBean;

		ImageAdapter(ArrayList<PictureBean> pathBean) {
			this.pathBean = pathBean;
		}
		
		
		@Override
		public int getCount() {
			return pathBean.size();
		}

		@Override
		public Object getItem(int position) {
			return null;
		}

		@Override
		public long getItemId(int position) {
			return position;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			View colView = convertView;
			ViewHolder viewCache;
			if (colView == null) {
				colView = getLayoutInflater().inflate(
						R.layout.czda_client_pic_grid_item, parent, false);
				viewCache = new ViewHolder();
				viewCache.imageView = (ImageView) colView
						.findViewById(R.id.image);
				viewCache.tvDate = (TextView) colView.findViewById(R.id.tvDate);
				colView.setTag(viewCache);
			} else {
				viewCache = (ViewHolder) colView.getTag();
			}
			PictureBean tempBean = pathBean.get(position);

			if ("a".equals(tempBean.getPicadd()) || tempBean.getPicadd().indexOf("日") >= 0
					|| tempBean.getPicadd().indexOf("天") >= 0) {
				viewCache.tvDate.setVisibility(View.VISIBLE);
				viewCache.imageView.setVisibility(View.GONE);
				if ("a".equals(tempBean.getPicadd())) {
					viewCache.tvDate.setText("");
				} else {
					viewCache.tvDate.setText(tempBean.getPicdate());
				}
				viewCache.imageView.setTag("");
				
			} else if ("".equals(tempBean.getPicadd())) {
				viewCache.tvDate.setVisibility(View.GONE);
				viewCache.imageView.setVisibility(View.INVISIBLE);
				viewCache.imageView.setTag("");
				
			} else {
				viewCache.tvDate.setVisibility(View.GONE);
				viewCache.imageView.setVisibility(View.VISIBLE);

				imageLoader.displayImage(tempBean.getPicadd(),
						viewCache.imageView, options);
				viewCache.imageView.setTag(tempBean.getPicadd());
				
			}
			viewCache.tvDate.setTag(tempBean.getPicdate());
			return colView;
		}

		private class ViewHolder {

			public ImageView imageView;
			public TextView tvDate;
		}
	}
}
